<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<script>

    var cardFlag=$("#cardFlagValue").val();
      //结账确认
    function  acctConfirm(){
         $.ajax({
              type:'post',
              url:'${ctx}/finance/outpAcctMaster/mergeAcctSaveInfo?cardFlag='+cardFlag,
              data:$('#patientInfo').serialize(),
              success:function(data){
               if(data.code=='success'){
                    toastr.success("结账成功");
                    loadByUrl(timestamp('${ctx}/finance/outpAcctMaster/mergeAcctPage'));
                    return;
               } else{
                       toastr.error("结账失败");
                       return ;
                   }
             }
        });
    }
</script>
<div class="app bg-default">
    <section class="layout">
        <div class="content-wrap">
            <div class="row" id="topDivId">
                <div class="col-lg-12">
                    <section class="panel">
                        <div class="panel-body">
                            <form class="form-inline" id="patientInfo" onsubmit="return loadDivForm('acctInfo','patientInfo',timestamp('${ctx}/finance/outpRcptMaster/acctMaster'));" method="post" >
                                <label>结账截止日期 ：</label>
                                <input name="endTime" value="${endTime}" id="acctEndDate"  class="form-control Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
                                &nbsp;&nbsp;<input  class="btn btn-primary" type="button" value="结账确认" onclick="acctConfirm();"/>
                            </form>
                        </div>
                    </section>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-6">
                    <section class="panel">
                        <div class="panel-body">
                            <div class="container">
                                <div class="own-span">合计费用：</div>
                                <form class="form-horizontal">
                                    <div class="col-lg-3">
                                        <div class="form-group">
                                            <label class="col-sm-4 control-label">应收金额:</label>
                                            <div class="col-sm-4">
                                                <input  name="sumAmount" value="${outpAcctMaster.sumAmount}" class="form-control" style="width: 100px;"/>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-4 control-label">实收金额:</label>
                                            <div class="col-sm-4">
                                                <input  name="chargesAmount" value="${outpAcctMaster.chargesAmount}" class="form-control" style="width: 100px;"/>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-lg-3">
                                        <div class="form-group">
                                            <label class="col-sm-4 control-label">退费金额:</label>
                                            <div class="col-sm-4">
                                                <input  name="refundAmount" value="${outpAcctMaster.refundAmount}" class="form-control" style="width: 100px;"/>
                                            </div>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </section>
                </div>
                <div class="col-lg-6">
                    <section class="panel">
                        <div class="panel-body">
                            <div class="own-span">支付明细：</div>
                            <table class="table table-bordered mg-t datatable">
                                <thead>
                                <tr>
                                    <th>支付方式</th>
                                    <th>收款金额</th>
                                    <th>退款金额</th>
                                    <th>实收小计</th>
                                </tr>
                                </thead>
                                <tbody>
                                <c:forEach items="${paymentsMones}" var="payments">
                                    <tr>
                                        <td>${fns:getDictLabel(payments.moneyType, 'PAY_WAY_DICT', defaultValue)}</td>
                                        <td>${payments.charges}</td>
                                        <td>${payments.refundCharges}</td>
                                        <td>${payments.costs}</td>
                                    </tr>
                                </c:forEach>
                                </tbody>
                            </table>
                        </div>
                    </section>
                </div>

            </div>

        </div>
    </section>
    <input type="hidden" id="cardFlagValue" value="${outpAcctMaster.cardFlag}">
</div>
</div>
</div>